function [] = showimage(filename);
x=load(filename);
tb = x(2:end,1)'; % get the time base out.
tb = tb * 0.012;
x=x(2:end,2:end)';
records = size(x,1);
for i = 1:records
   xi(i,:) = x(i,:)/median(x(i,:)); % use median filter for f/f0
end;

fsamp = 1/0.012; % sample rate in sec per point.

if(exist('filter'))
   % smooth the data out a bit
   for i = 1:records
      fco = 10;		% cutoff frequency in Hz
      wco = fco/(fsamp/2); % wco of 1 is for half of the sample rate, so set it like this...
      if(wco < 1) % if wco is > 1 then this is not a filter!
         [b, a] = butter(8, wco); % Butterworth filter
         xsmo(i,:) = filter(b, a, xi(i,:)); % filter all the traces...
      else
         xsmo(i,:) = xi(i,:);
         fprintf('did not smooth');
      end
   end
else
   for i = 1:records
      xsmo(i,:) = xi(i,:)-mean(xi(i,:));
   end;
end;
xs = diff(xsmo(:,2:end)')';
subplot('Position', [0.1, 0.5, 0.8, 0.4]);
plot(tb(1:end), xsmo);

subplot('position', [0.1, 0.05, 0.4, 0.35]);
cla
n=1;
for i = 1:records
   [ac{n}, aclags{n}] = xcov(xsmo(i,5:end));
   plot(aclags{n}, ac{n});
   n = n + 1;
   hold on;
end;
set(gca, 'XLim', [-600,600]);

subplot('position', [0.5, 0.05, 0.4, 0.35]);
cla
n=1;
for i = 1:records
   for j = i+1:records
      [xc{n}, lags{n}] = xcov(xsmo(i,:), xsmo(j,:));
      plot(lags{n}, xc{n});
      n = n + 1;
      hold on;
   end;
end;
set(gca, 'XLim', [-600,600]);
